package com.cloudptt.wp.ui.views;

import com.cloudptt.api.product.log.Log;
import com.cloudptt.wp.R;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
import android.widget.TextView;

public class GroupcallStateLayout extends LinearLayout {

	private TextView mNameTv;
	private TextView mStateTv;
	private TextView mTimertv;
	
	public GroupcallStateLayout(Context context) {
		this(context, null);
		// TODO Auto-generated constructor stub
	}

	public GroupcallStateLayout(Context context, AttributeSet attrs) {
		this(context, attrs, 0);
		// TODO Auto-generated constructor stub
	}

	public GroupcallStateLayout(Context context, AttributeSet attrs, int defStyleAttr) {
		this(context, attrs, defStyleAttr, 0);
		// TODO Auto-generated constructor stub
	}

	public GroupcallStateLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
		super(context, attrs, defStyleAttr, defStyleRes);
		// TODO Auto-generated constructor stub
		LayoutInflater.from(context).inflate(R.layout.layout_group_call_state, this);
		mNameTv = (TextView)findViewById(R.id.groupNameTv);
		mStateTv = (TextView)findViewById(R.id.callStatusTv);
		mTimertv = (TextView)findViewById(R.id.timerTv);
	}
	
	/*public TextView getNameView(){
		return mNameTv;
	} 
	
	public TextView getStateView(){
		return mStateTv;
	}*/
	
	/*public boolean isNameShown(){
		return mNameTv.isShown();
	}*/
	
	public void setGroupName(String name){
		Log.debug(GroupcallStateLayout.class, "setGroupName name = " + name);
		if(mNameTv != null){
			mNameTv.setText("[ " + name + " ]");
		}
	}
	
	public void setState(String callstate){
		if(mStateTv != null){
			mStateTv.setText(callstate);
		}
	}

	public void updateTimer(String timerStr){
		if(mTimertv != null){
			mTimertv.setText(timerStr);
		}
	}

	public void cleanTimer(){
		if(mTimertv != null){
			mTimertv.setText("");
		}
	}
	
	public void resetView(){
		mNameTv.setText("");
		mStateTv.setText("");
		mTimertv.setText("");
	}
	
}
